<?php

namespace App\Model\Chat;

use App\Model\Model;
use Hyperf\Database\Model\SoftDeletes;

/**
 * @property integer $id
 * @property boolean $types
 * @property integer $create_time
 * @property integer $update_time
 * @property integer $delete_time
 * @property text $content
 * @property integer $user_id
 */
class ChatMessage extends Model
{
    use SoftDeletes;

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'chat_message';

    protected $fillable = [
        'types',
        'create_time',
        'update_time',
        'delete_time',
        'content',
        'user_id',
    ];

    protected $appends = [
        'update_time_format'
    ];

    public function getUpdateTimeFormatAttribute()
    {
        return $this->checkAttributes('update_time', function ($value) {
            return date('Y-m-d H:i:s', $value);
        });
    }

}
